<?php
App::uses('AppModel', 'Model');
/**
 * Fee Model
 */
class BankReportLog extends AppModel {

    public $belongsTo = array(
        'BankUser' => array(
            'className' => 'BankUser',
            'foreignKey' => 'bank_user_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );

    public function save($data = null,$validate = true, $fieldList = array()) {
        $s = $this->sanitize($data);
        return parent::save($s);
    }

    function getNewBatchNo(){
        $num = $this->getNextAutoIncrement();
        $num_length = strlen((string)$num);
        if($num_length < 2){
            $diff = 2 - $num_length;
            $zeros = '';
            for($x=1; $x <= $diff; $x++){
                $zeros .= '0';
            }
            $new_num = $zeros.$num;
        }
        else{
            $new_num = $num;
        }

        return $new_num;
    }
}